/*
 * RentalBO.java
 *
 * Created on March 22, 2007, 4:51 PM
 *
 */

package Data;
import java.util.*;
/**
 * @author Justin
 */
public class RentalBO extends RevenueSourceBO {
    
    //protected String id;       already included in abstract RevenueSourceBO
    //protected String description;            "           "
    //protected boolean alreadyInDB=false;     "           "
    //protected boolean dirty = true;          "           "
    private String RentalProductID;
    private Date DateOut;
    private Date DateDue;
    private int DaysToRent;  //ask professor Hansen about customers choosing length of rental
    
    
    /** Creates a new instance of RentalBO */
    public RentalBO(String id) {
      this.id = id;   
    }
    
    public double calculateRentalPrice(){      //calculates the rental price for the transaction
        double total_rent_price = 0;
        //id for this class is the physical product id
        //use physical product id to find conceptual id
        //use conceptual id to get to conceptual rental, which has price per day
        
        //total_rent_price = priceperday * DaysToRent;        
        
        return total_rent_price;
    }
    
    public Date calculateDateDue(){         //finds the date due using the DateOut and DaysToRent attributes
      Calendar c = Calendar.getInstance();
      c.setTime(DateOut);
      c.add(c.DAY_OF_MONTH, DaysToRent);
      DateDue = c.getTime();    //calculates the date due by using the date it is reserved
      return DateDue;           //as the dateout, and adds the number of days to rent to find due date.
    }
    
    public Date getDateOut() {        //gets the date out
        return DateOut;
    }

    public void setDateOut(Date DateOut) {     //sets the dateout
        this.DateOut = DateOut;
    }

    public Date getDateDue() {              //gets the datedue
        return DateDue;
    }

    public void setDateDue(Date DateDue) {       //sets the datedue
        this.DateDue = DateDue;
    }

    public int getDaysToRent() {          //gets the number of days that the member can rent the item for
        return DaysToRent;
    }

    public void setDaysToRent(int DaysToRent) {     //sets the number of days the customer can rent the item
        this.DaysToRent = DaysToRent;
    }

    public void calculatePrice() {
        // PhysicalProductBO physicalProduct = this.g;
        double price = 0.0;//calculate the price here based on the physical product and days rented.
        super.setPrice(price);
    }

    public String getRentalProductID() {          //gets the id of the product in the rental
        return RentalProductID;
    }

    public void setRentalProductID(String RentalProductID) {   //sets the id of the product in the rental
        this.RentalProductID = RentalProductID;
    }
}
